package com.jic.market.controller.manage;

import com.jic.common.base.vo.PageResult;
import com.jic.common.base.vo.RestResult;
import com.jic.market.entity.Material;
import com.jic.market.entity.TagCategory;
import com.jic.market.request.MaterialQueryRequest;
import com.jic.market.response.TagCategoryFirstInfo;
import com.jic.market.response.TagCategoryInfo;
import com.jic.market.service.TagCategoryService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.sql.ResultSet;

@RestController
@RequestMapping("/tagCategory")
public class TagCategoryController {
    @Autowired
    private TagCategoryService tagCategoryService;

    @ApiOperation(value = "列表查询")
    @RequestMapping(value = "queryPage", method = RequestMethod.POST)
    public RestResult<PageResult<TagCategoryFirstInfo>> queryPage(@RequestBody TagCategory request) {
        return tagCategoryService.queryPage(request);
    }

    @ApiOperation(value = "分类新增")
    @RequestMapping(value = "addTagCategory", method = RequestMethod.POST)
    public RestResult<Long> addTagCategory(@RequestBody TagCategory request) {
        return tagCategoryService.insertTag(request);
    }

    @ApiOperation(value = "编辑分类")
    @RequestMapping(value = "editTagCategory",method = RequestMethod.POST)
    public RestResult<Long> editTagCategory(@RequestBody TagCategory  param){
        return  tagCategoryService.editTag(param);
    }

    @ApiOperation(value = "删除分类")
    @RequestMapping(value = "delTagCategory",method = RequestMethod.POST)
    public RestResult<Long> delTagCategory(@RequestBody TagCategory param){
        return  tagCategoryService.delTag(param);
    }

    @ApiOperation(value = "标签管理查询标签分页")
    @RequestMapping(value = "getTagList",method = RequestMethod.POST)
    public RestResult<PageResult<TagCategoryInfo>>  getTagList(@RequestBody TagCategory param){
        return  tagCategoryService.getTagList(param);
    }
}
